import { createRouter, createWebHistory } from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
import InfoList from './pages/info/InfoList.vue'

import RequirementList from './pages/requirement/RequirementList.vue'
import RequirementDetail from './pages/requirement/RequirementDetail.vue'
import RequirementBase from './pages/requirement/RequirementBase.vue'

import ForumBase from './pages/forum/ForumBase.vue'
import QuestionList from './pages/forum/QuestionList.vue'
import QuestionDetail from './pages/forum/QuestionDetail.vue'
import ForumDemo from './pages/forum/ForumDemo.vue'

import SessionList from './pages/msg/SessionList.vue'
import Session from './pages/msg/Session.vue'

import UserCenter from "@/pages/user/UserCenter.vue";
import AppLogin from "@/pages/user/AppLogin.vue";

const routes = [
  { path: '/', component: HelloWorld },
  { path: '/info-list', component: InfoList },

  {
    path: '/forum',
    component: ForumBase,
    children: [{
      path: 'question',
      component: QuestionList,
      meta: { showNavTop: true }
    }, {
      path: 'question/detail',
      component: QuestionDetail,
      meta: { showNavTop: true }
    },
    {
      path:'demo',
      component:ForumDemo
    }]
  },

  {
    path:'/user',
    component:import('@/pages/user/UserCenter2.vue'),
    meta: { showNavTop: false }},
  {
    path:'/mine',
    component:import('@/pages/user/AppMine.vue'),
    meta: { showNavTop: false }},
  {
    path:'/coupon-publish',
    component:import('@/pages/user/CouponPublish.vue'),
    meta: { showNavTop: false }},
  {
    path:'/user2',
    component:import('@/pages/user/UserCenter2.vue'),
    meta: { showNavTop: false }},
  {
    path:'/login',
    component:AppLogin,
    meta: { showNavTop: false }
  },


  {
    path:'/session',component:SessionList,
    meta: { showNavTop: true}
  },
  {
    path:'/session/detail',
    component:Session,
    meta: { showNavTop: true}
  },

  {
    path: '/forum/question/list', component: ForumDemo
  },

  {
    path: '/requirement',
    name: 'requirement',
    component: RequirementBase,
    children: [{
      path: '',
      component: RequirementList
      // component:()=>import('./pages/requirement/RequirementList.vue')
    }, {
      path: 'detail',
      component: RequirementDetail
      // component:()=>import('./pages/requirement/RequirementDetail.vue')
    }]
  },

  // {
  //   path: '/login'
  // },
  // {
  //   path: '/register'
  // },
  // {
  //   path: '/usercenter'
  // }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
